#pragma once
#include <list>
#include <vector>
#include <string>
#include "../../../parser/SQLExprParser.h"

class SQLParserFeature;
class MySqlPrimaryKey;
class SQLDDLStatement;
class SQLPartition;
class SQLSubPartition;

class MySqlExprParser : public SQLExprParser
{
public:
  static std::shared_ptr<std::vector<string_ptr>> AGGREGATE_FUNCTIONS;

  static std::shared_ptr<std::vector<long>> AGGREGATE_FUNCTIONS_CODES;

  static std::shared_ptr<std::vector<string_ptr>> SINGLE_WORD_TABLE_OPTIONS;

  static std::shared_ptr<std::vector<long>> SINGLE_WORD_TABLE_OPTIONS_CODES;

  static std::shared_ptr<std::vector<string_ptr>> strings;
  static std::shared_ptr<std::vector<string_ptr>> options;

  static BOOL_ptr __init;
  static BOOL_ptr init();

  MySqlExprParser(Lexer_ptr lexer);

  MySqlExprParser(string_ptr sql);

  MySqlExprParser(string_ptr sql, SQLParserFeature_list_ptr features);

  MySqlExprParser(string_ptr sql, BOOL_ptr keepComments);

  MySqlExprParser(string_ptr sql, BOOL_ptr skipComment, BOOL_ptr keepComments);
  SHAREDOBJECT(MySqlExprParser) ;
  virtual SQLExpr_ptr primary() override;

  virtual SQLExpr_ptr primaryRest(SQLExpr_ptr expr) override;

  SQLSelectParser_ptr createSelectParser() override;

  SQLColumnDefinition_ptr parseColumn() override;

  SQLColumnDefinition_ptr parseColumnRest(SQLColumnDefinition_ptr column) override;

  SQLAssignItem_ptr parseAssignItem(BOOL_ptr variant, SQLObject_ptr parent) override;

  SQLName_ptr nameRest(SQLName_ptr name) override;

  // MySqlPrimaryKey* parsePrimaryKey();

  // MySqlUnique* parseUnique();

  // MysqlForeignKey* parseForeignKey();

  // MySqlOrderingExpr* parseSelectGroupByItem();

  SQLSubPartition_ptr parseSubPartition();

  SQLPartition_ptr parsePartition();

  BOOL_ptr parseTableOptions(SQLAssignItem_list_ptr assignItems, SQLDDLStatement_ptr parent);
  SQLName_ptr userName();
  SQLExpr_ptr userNameRest(SQLExpr_ptr expr);
  // protected:
  // MySqlJSONTableExpr::Column *parseJsonTableColumn();
  SQLExpr_ptr parseAliasExpr(string_ptr alias) override;
  SQLAggregateExpr_ptr parseAggregateExprRest(SQLAggregateExpr_ptr aggregateExpr) override;
  SQLDataType_ptr parseDataTypeRest(SQLDataType_ptr dataType) override;
  SQLExpr_ptr parseInterval() override;
  SQLExpr_ptr parseExtract();
  SQLExpr_ptr parsePosition();
};
